import { _decorator, Component, Node } from "cc";
import { getGlobal, MyGlobal } from "../Global";
const { ccclass, property } = _decorator;

@ccclass("Login")
export class Login extends Component {
  g: MyGlobal;
  onLoad() {
    let g = getGlobal();
    this.g = g;
    g.utils.setFitSreenMode();
    g.audio.playBGM("bgMain.mp3");
    g.socket.addHandler("push_need_create_role", () => {
      cc.director.loadScene("createrole");
    });
    console.log(g.userMgr.statics, "??g.userMgr.statics");
    if (g.userMgr.statics.userId) {
      g.userMgr.travelerAuth();
    }
  }
  start() {}
  handleBtnClick(e: cc.Event, key) {
    switch (key) {
      case "wechat":
        break;
      case "traveler": //游客
        this.g.userMgr.travelerAuth();
        break;
    }
  }
  update(deltaTime: number) {}
}
